package com.cloud.lan.api.manage;

import com.cloud.lan.api.dto.req.LanTagCfgReq;
import com.cloud.lan.entity.base.BaseResponse;
import com.cloud.lan.entity.base.ListResponse;
import com.cloud.lan.entity.model.dataobject.LanTagCfgDO;
import com.cloud.lan.service.ILanTagCfgService;
import com.cloud.lan.service.ILanTagUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by zhouquan on 2022/4/14.
 */
@RestController
@RequestMapping(value = {"/v1/manage/tag/cfg"}, method = {RequestMethod.GET, RequestMethod.POST}, produces = {"application/json"})
public class LanTagCfgManageApi {

    @Autowired
    private ILanTagCfgService iLanTagCfgService;
    @Autowired
    private ILanTagUserService iLanTagUserService;

    @RequestMapping("query")
    public ListResponse<List<LanTagCfgDO>> query(LanTagCfgReq cfgReq){
        return iLanTagCfgService.queryTagCfgList(cfgReq);
    }

    @RequestMapping("add")
    public BaseResponse<Object> add(LanTagCfgReq cfgReq){
        return iLanTagCfgService.add(cfgReq);
    }

    @RequestMapping("timeHandle")
    public BaseResponse<Object> timeHandle(String tagCode){
        iLanTagUserService.timeHandle(tagCode);
        return BaseResponse.success();
    }
}
